package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.ISysAssessmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.ruoyi.common.core.domain.AjaxResult.success;

@RestController
@RequestMapping("/system/assessment")
public class SysAssessmentController {

    @Autowired
    private ISysAssessmentService sysAssessmentService;


    @GetMapping("getTemplate")
    @PreAuthorize("@ss.hasPermi('system:assessment:export')")
    public AjaxResult getTemplate() {
        return success(sysAssessmentService.getTemplate());
    }

    @GetMapping("getAssessmentByUserId/{userId}")
    @PreAuthorize("@ss.hasPermi('system:assessment:downloadAssessment')")
    public AjaxResult getAssessmentByUserId(@PathVariable Long userId) {
        return success(sysAssessmentService.selectAssessmentByUserId(userId));
    }
}
